package com.fin.quant.web.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.Map;

public class JsonUtils {

    private static Gson gson = new Gson();
    private static Gson prettyGson = new GsonBuilder().setPrettyPrinting().create();

    public static String toJson(Object Object) {
        return gson.toJson(Object);
    }

    public static String toPrettyJson(Object Object) {
        return prettyGson.toJson(Object);
    }

    public static Map toMapObject(String json) {
        return gson.fromJson(json, Map.class);
    }

    public static <T> T fromJson(String json, Class<T> classOfT) {
        return gson.fromJson(json, classOfT);
    }
}
